package com.example.power_test;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class MainActivity_power extends Activity implements OnItemClickListener{

	private TextView tv1;
	private ListView lv1;
	private Intent intent;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		tv1 = (TextView) findViewById(R.id.textView1);
		lv1 = (ListView) findViewById(R.id.listView1);
		String[] str = {"CPU","DISPLAY","NETWORK","WIFI","GPS"};
		lv1.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, str));
		lv1.setOnItemClickListener(this);
	}

	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		switch(arg2){
		case 0:
			tv1.setText("CPU test");
			intent = new Intent(MainActivity_power.this,CPUTestActivaty.class);
			startActivity(intent);
			break;
		case 1:
			tv1.setText("DISPLAY test");
			intent = new Intent(MainActivity_power.this,DISTestActivity.class);
			startActivity(intent);
			break;
		case 2:
			tv1.setText("NETWORK test");
			intent =  new Intent(MainActivity_power.this,NETTestActivity.class);
			startActivity(intent);
			break;
		case 3:
			tv1.setText("WIFI test");
			intent = new Intent(MainActivity_power.this,WIFITestactivity.class);
			startActivity(intent);
			break;
		case 4:
			tv1.setText("GPS test");
			break;
		}
	}
}
